var install_ip_port = 'http://120.25.151.57:8080/';
var url = install_ip_port + 'apk_dir/update.apk';

function download_apk() {
	var wt = plus.nativeUI.showWaiting("正在下载新版版本...");
	var dtask = plus.downloader.createDownload(url, {}, function(d, status) {
		wt.close();
		if(status == 200) { // 下载成功
			var path = d.filename;
			install_apk(path);
		} else { //下载失败
			alert("Download failed: " + status);
		}
	});
	dtask.start();
}

function install_apk(path){
	var wt = plus.nativeUI.showWaiting("正在安装...");
	// 安装下载的apk文件
	plus.runtime.install(path); 
	plus.runtime.quit();
	wt.close();
}
